package com.example.tb;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.mingle.widget.LoadingView;

/**
 * Created by 汪贵春 on 2016/5/25.
 */
public class WebActivity extends AppCompatActivity {

    private WebView contentWeb;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        String data = getIntent().getStringExtra("word");

        if(data.equals("")){
            this.setTitle("首页");
        }else{
            this.setTitle(data);
        }

        setContentView(R.layout.activity_web);
        contentWeb = (WebView) findViewById(R.id.webView);

        contentWeb.getSettings().setJavaScriptEnabled(true);
        contentWeb.setWebViewClient(new WebViewClient(){
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
            }
        });

        contentWeb.loadUrl("http://www.iciba.com/" + data);
    }
}
